package com.roger.springcloudGreenwich;

import java.util.ArrayList;
import java.util.List;

public class SortTest {
    public static void main(String[] args) {
        List<FlowNode> list = new ArrayList();
        FlowNode node1 = new FlowNode(1,0);
        FlowNode node2 = new FlowNode(2,1);
        FlowNode node3 = new FlowNode(3,4);
        FlowNode node4 = new FlowNode(4,2);
        list.add(node1);
        list.add(node2);
        list.add(node3);
        list.add(node4);

        List<String> list2 = new ArrayList<>();
        list2.add("项目经理1");
        list2.add("项目经理2");
        list2.add("项目经理3");
        list2.add("部门主管");
        String[] str = list2.toString().replace("]","")
                .replace("[","").split(",");
        StringBuilder sb = new StringBuilder();
        for(String value : str){
            sb.append("'").append(value.trim()).append("',");
        }
        int last = sb.lastIndexOf(",");
        System.out.println(sb.substring(0 , last));
        String value = "";
        for(String name : list2){
            if(name.contains("项目经理")){
                value = name;
                break;
            }
        }
        System.out.println(value);
    }

    public void sort(List<FlowNode> list){
        List<FlowNode> newList = new ArrayList<>();

        for(int i = 0; i < list.size(); i++){

        }

    }
}

class FlowNode{
    private int id;

    private int parentId;

    public FlowNode(int id , int parentId){
        this.id = id;
        this.parentId = parentId;
    }

    public int getId() {
        return id;
    }

    public int getParentId() {
        return parentId;
    }
}
